/*
	Written By Pradipna Nepal
	www.pradsprojects.com

	Copyright (C) 2012 Prads Projects
	Please read COPYING.txt included along with this source code for more detail.
	If not included, see http://www.gnu.org/licenses/
*/

#ifndef RESIR_H
#define RESIR_H

enum OpcodesIR {
	NOP = 0,					//No operation
	CLS = 1,					//Clear screen
	VBLNK = 2,					//Wait for VBlank
	BGC = 3,					//Set Background color
	SPR = 4,					//Set sprite size
	DRW_HHLL = 5,				//Draw Sprite
	DRW_RZ = 6,					//Draw Sprite from register
	RND = 7,					//Generate random number
	FLIP = 8,					//Flip Sprite
	
	JMP_HHLL = 0x10,			//Jump
	JX = 0x12,					//Conditional Jump
	JME = 0x13,					//Conditional Jump
	JMP_RX = 0x16,				//Jump to address in register
	
	CALL_HHLL = 0x14,			//Call to a subroution
	RET = 0x15,					//Return from subroutine
	CX = 0x17,					//Conditional call
	CALL_RX = 0x18,				//Call to a subroutine in address in register
	
	LDI_RX_HHLL = 0x20,			//Load immediate value to register
	LDI_SP_HHLL = 0x21,			//Change SP address
	LDM_HHLL = 0x22,			//Load register with data from memory
	LDM_RY = 0x23,				//Load register with data from memory
	MOV = 0x24,					//Move data between registers
	
	STM_HHLL = 0x30,			//Store register to memory
	STM_RY = 0x31,				//Store register to memory
	
	ADDI = 0x40,				//Add register with immediate value
	ADD = 0x41,					//Add
	ADD_RZ = 0x42,				//Add and store result in register Z
	
	SUBI = 0x50,				//Subtract register with immediate value
	SUB = 0x51,					//Subtract
	SUB_RZ = 0x52,				//Subtract and store the result in register Z
	
	CMPI = 0x53,				//Compare register with immidiate value
	CMP = 0x54,					//Compare registers

	ANDI = 0x60,				//AND register with immidiate value
	AND = 0x61,					//And registers
	AND_RZ = 0x62,				//And and store the result in register Z

	TSTI = 0x63,				//Test register with immidiate value
	TST = 0x64,					//Compare registers

	ORI = 0x70,					//OR register with immidiate value
	OR = 0x71,					//OR registers
	OR_RZ = 0x72,				//OR and store the results in register Z

	XORI = 0x80,				//XOR register with immidiate value
	XOR = 0x81,					//XOR registers
	XOR_RZ = 0x82,				//XOR and store the result in register Z

	MULI = 0x90,				//Multiply register with immidiate value
	MUL = 0x91,					//Multiply registers
	MUL_RZ = 0x92,				//Multiply and store the result in register Z

	DIVI = 0xA0,				//Divide register with immidiate value
	DIV = 0xA1,					//Divide registers
	DIV_RZ = 0xA2,				//Divide and store the result in register Z

	SHIFT_N = 0xB0,				//Shift left N times
	SHR_N = 0xB1,				//Logical shift right N times
	SAR_N = 0xB2,				//Arithematic shift right N times

	SHIFT_RY = 0xB3,			//Shift left (register Y & 0xF) times
	SHR_RY = 0xB4,				//Logical shift right (register Y & 0xF) times
	SAR_RY = 0xB5,				//Arithematic shift right (register Y & 0xF) times

	PUSH_RX = 0xC0,				//Push register X in stack
	POP_RX = 0xC1,				//Pop from stack to register X
	PUSHALL = 0xC2,				//Push every general purpose registers to stack
	POPALL = 0xC3,				//Pop from stack to every register
	PUSHF = 0xC4,				//Push flag in stack
	POPF = 0xC5,				//Pop from stack to flag

	PAL_HHLL = 0xD0,			//Load palette
	PAL_RX = 0xD1,				//Load palette from address pointed to by register X

	PRNT,
	DRAW,
	CTRL1
};

#endif